//
//  TCMySecondTableViewCell.m
//  Project_B
//
//  Created by dllo on 15/11/24.
//  Copyright © 2015年 张闯. All rights reserved.
//

#import "TCMySecondTableViewCell.h"
#import "UIImageView+WebCache.h"
#define WIDTH [[UIScreen mainScreen] bounds].size.width / 375
#define HEIGHT [[UIScreen mainScreen] bounds].size.height / 667
@interface TCMySecondTableViewCell ()
@property (nonatomic, strong)UIImageView *bigimage;
@property (nonatomic, strong)UIImageView *smallimage;
@property (nonatomic, strong)UILabel *titlelabel;
@property (nonatomic, strong)UILabel *namelabel;
@property (nonatomic, strong)UIImageView *twoimage;
@property (nonatomic, strong)UIImageView *threeimage;

@end
@implementation TCMySecondTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.bigimage = [[UIImageView alloc]init];
        [self.contentView addSubview:self.bigimage];
        
        self.twoimage = [[UIImageView alloc]init];
        [self.contentView addSubview:self.twoimage];
        
        self.threeimage = [[UIImageView alloc]init];
        [self.contentView addSubview:self.threeimage];
        
        self.smallimage = [[UIImageView alloc]init];
        [self.contentView addSubview:self.smallimage];
        
        self.titlelabel = [[UILabel alloc]init];
        [self.titlelabel setTextColor:[UIColor blueColor]];
        [self.contentView addSubview:self.titlelabel];
        
        self.namelabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.namelabel];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.titlelabel.frame = CGRectMake(10*WIDTH, 10*HEIGHT, 355*WIDTH, 30*HEIGHT);
    self.bigimage.frame = CGRectMake(10*WIDTH, 40*HEIGHT, 355/3*WIDTH-5, 90*HEIGHT);
    self.twoimage.frame = CGRectMake((355/3+10)*WIDTH, 40*HEIGHT, 355/3*WIDTH-5, 90*HEIGHT);
    self.threeimage.frame = CGRectMake((355/3*2+10)*WIDTH, 40*HEIGHT, 355/3*WIDTH-5, 90*HEIGHT);
    self.smallimage.frame = CGRectMake(245*WIDTH, 133*HEIGHT, 30*WIDTH, 30*HEIGHT);
    self.namelabel.frame = CGRectMake(275*WIDTH, 130*HEIGHT, 90*WIDTH, 30*HEIGHT);
}
- (void)setTemp:(TCTopic *)temp
{
    if (self.temp != temp) {
        _temp = temp;
    }
    self.namelabel.text = temp.nickname;
    [self.smallimage sd_setImageWithURL:[NSURL URLWithString:temp.headicon] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    self.titlelabel.text = temp.topic_title;
    NSArray *arr = (NSArray *)temp.topicimagelist;
    [self.bigimage sd_setImageWithURL:[NSURL URLWithString:arr[0][@"images"]] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    [self.twoimage sd_setImageWithURL:[NSURL URLWithString:arr[1][@"images"]] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    [self.threeimage sd_setImageWithURL:[NSURL URLWithString:arr[2][@"images"]] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
